import requests
import app


class DepartmentAPI:
    def __init__(self):
        self.url_add_department = app.BASE_URL + "/api/company/department"
        self.url_get_department = app.BASE_URL + "/api/company/department/{}"
        self.url_update_department = app.BASE_URL + "/api/company/department/{}"
        self.url_delete_department = app.BASE_URL + "/api/company/department/{}"

    def add_department(self, add_department_data):
        return requests.post(url=self.url_add_department, json=add_department_data, headers=app.headers_data)

    def get_department(self, department_id):
        return requests.get(url=self.url_get_department.format(department_id), headers=app.headers_data)

    def update_department(self, department_id, update_data):
        return requests.put(url=self.url_update_department.format(department_id), json=update_data, headers=app.headers_data)

    # def delete_department(self, department_id):
    #     return requests.delete(url=self.url_delete_department.format(department_id), headers=app.headers_data)

    def delete_department(self, department_id):
        url = self.url_delete_department.format(department_id)
        return requests.delete(url=url, headers=app.headers_data)aaa